package cn.bugstack.mybatis.executor;

import cn.bugstack.mybatis.mapping.BoundSql;
import cn.bugstack.mybatis.mapping.MappedStatement;
import cn.bugstack.mybatis.session.ResultHandler;
import cn.bugstack.mybatis.session.RowBounds;
import cn.bugstack.mybatis.transaction.Transaction;

import java.sql.SQLException;
import java.util.List;

/**
 * @author wcc
 * @description 执行器
 * @create
 */
public interface Executor {
    ResultHandler NO_RESULT_HANDLER = null;
    <E>List<E> query(MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql);
    <E> List<E> query(MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler) throws SQLException;
    Transaction getTransaction();
    int update(MappedStatement ms, Object parameter) throws SQLException;
    void commit(boolean required) throws SQLException;
    void rollback(boolean required) throws  SQLException;
    void close(boolean forceRollback);
}
